import {hasToken} from '@/utils/storage'
import {Redirect,Route} from 'react-router-dom'
export default function PrivateRoute(props) {
    console.log(props);
    const Abc=props.component 
    return (
        <Route path={props.path} render={()=>{
            if(hasToken()) {
                return <Abc></Abc>
            }else{
                // return <Redirect to='/login'></Redirect>
                return <Redirect to={{pathname:'/login',state:{from:props.location.pathname}}}></Redirect>

            }
        }}></Route>
    )
}